﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Syberia.Metacode
{
    public class ExplorableObject
    {
        public virtual string Name
        {
            get { return "<unnamed>"; }
        }

        public virtual IEnumerable<ExplorableObject> SubObjects
        {
            get
            {
                return null;
            }
        }


        public virtual TreeNode Visualize()
        {
            return Visualize(true);
        }

        public virtual object EditableObject
        {
            get { return null; }
        }

        protected TreeNode Visualize(bool hasSubnodes)
        {
            TreeNode t = new TreeNode();
            t.Name = Name;
            t.Text = Name;
            if (hasSubnodes) t.Nodes.Add("<expander helper>");
            t.Tag = this;
            return t;
        }
    }
}
